Skip to content

fix: implement missing utilities and fix edge-case bugs#235

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2474-1782924847
Open

fix: implement missing utilities and fix edge-case bugs#235
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2474-1782924847

Conversation

@stooit

@stooit stooit commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously-failing tests across 5 utility modules. All 60 tests now pass (bun test), and tsc --noEmit is clean. No test files were modified and no dependencies were added — fixes are minimal and scoped to what the tests require.

Changes

  • src/calculator.tsdivide now throws "Division by zero" when the divisor is 0 (was returning Infinity).
  • src/string-utils.tswordCount trims and splits on /\s+/ so consecutive spaces no longer count as words; truncate implemented (returns unchanged within limit, truncates at word boundary, ellipsis counts toward maxLength, handles strings shorter than the ellipsis).
  • src/task-manager.ts — completed the missing/incomplete remove, update, and sortBy methods (priority high→medium→low; createdAt oldest-first; unknown IDs return false).
  • src/date-utils.tsformatRelative uses Math.round instead of Math.floor for the day count, fixing the off-by-one (36 hours → "2 days ago").
  • src/validator.tsisEmail accepts long TLDs and subdomains (e.g. user@example.museum); isUrl accepts URLs with a port (e.g. http://localhost:3000).

Verification

  • bun test: 60 pass / 0 fail
  • bunx tsc --noEmit: clean
  • Reviewed by review subagent: no blockers.

Notes / Assumptions

  • Per the task constraint "fix only what the tests require", a few pre-existing untested edge cases were left as-is: truncate with maxLength <= 0, the 23h59m cosmetic boundary in formatRelative, and alphabetical ordering for sortBy("status"). None are exercised by the suite and none are regressions.

Make all 60 tests pass across 5 source modules:
- calculator: divide now throws on division by zero
- string-utils: fix wordCount for consecutive spaces; implement truncate
- task-manager: complete missing remove/update/sortBy methods
- date-utils: use Math.round for day boundary (36h -> 2 days ago)
- validator: isEmail allows long TLDs/subdomains; isUrl accepts ports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant